<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	String path = request.getContextPath();
	// 获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	// 将 "项目路径basePath" 放入pageContext中，待以后用EL表达式读出。 
	pageContext.setAttribute("basePath", basePath);
%>
<%@include file="../common/jscss.jsp"%>
<script type="text/javascript">
<!--
	function auditManage(type) {
		clearAuditMenuStyle();
		$("#audit_menu_"+type).css({"color":"red"});
		switch (type) {
			case '1': {
				$('#audit_content').load("/misc/audit/blog.htm");
				break;
			}
			case '2': {
				$('#audit_content').load("/misc/audit/doing.htm");
				break;
			}
			case '3': {
				$('#audit_content').load("/misc/audit/topic.htm");
				break;
			}
			case '4': {
				$('#audit_content').load("/misc/audit/picture.htm");
				break;
			}
			case '5': {
				$('#audit_content').load("/misc/audit/blacklist.htm");
				break;
			}
			case '6': {
				$('#audit_content').load("/misc/audit/doingStat.htm");
				break;
			}
		}
	}
	//清除样式
	function clearAuditMenuStyle(){
		$("#audit_menu_1").css({"color":""});
		$("#audit_menu_2").css({"color":""});
		$("#audit_menu_3").css({"color":""});
		$("#audit_menu_4").css({"color":""});
		$("#audit_menu_5").css({"color":""});
		$("#audit_menu_6").css({"color":""});
	}
	//确认推送内容
	function queRenTuiSong() {
		if($("#chooseChannel").val()==""){
			alert("请选择频道");
		}else{
			var contentList = new Array();
			var parentId = $("#parent_val").val();
			var channel = $("#"+parentId).ligerGetComboBoxManager().getValue();
			var hyperlink = "";
			$("#search_result").find("input:checkbox").each(function(i) {
				if ($(this).attr("checked") == "checked") {
					var doorplate = $(this).parent().find("#doorplate").html();
					var title = $(this).parent().find("#title").html();
					var description = $(this).parent().find("#description").html();
					var nickname = $(this).parent().find("#nickname").html();
					var tblName = $(this).parent().find("#tblName").html();
					var tblIdentifier = $(this).parent().find("#tblIdentifier").html();
					var systemTag = $(this).parent().find("#systemTag").html();
					//推送链接
					if($("#doingSearch").find("#product").attr("checked")=="checked"){
						hyperlink = "/shop/go.htm?pid="+tblIdentifier;
					}
					//推送图片
					var picture = $(this).parent().find("#picture").html();
					var videoPic = $(this).parent().find("#videoPic").html();
					var productPic = $(this).parent().find("#productPic").html();
					var pictorialPic = $(this).parent().find("#pictorialPic").html();
					if(pictorialPic!=""){
						picture = pictorialPic;
					}else if(productPic!=""){
						picture = productPic;
					}else if(videoPic!=""){
						picture = videoPic;
					}
					
					contentList.push({
						"channel" : channel,
						"title" : title,
						"description" : description,
						"nickname" : nickname,
						"picture" : $.trim(picture),
						"hyperlink" : "<%=basePath %>"+hyperlink,
						"tblName" : tblName,
						"tblIdentifier" : tblIdentifier,
						"systemTag" : systemTag
					});
				}
			});
			if(contentList.length==0){
				alert("请选择推送内容");
				return;
			}
			$("#que_ren_tui_song").attr("onclick","");
			//提交数据
			$.post("/misc/cms/commendContent.htm",{
				contentList : $.toJSON(contentList)
			},function(data){
				if(data=="error"){
					alert("亲，系统现在有点抽经，这次操作没有成功！");
				}else if(data==0){
					alert("亲，"+contentList.length+"条内容推送成功！");
				}else if(contentList.length==data){
					alert("亲，您推送的这"+contentList.length+"条内容该频道已经有了，您还是换个吧！");
				}else{
					alert("亲，您推送的内容有"+data+"个该频道已经有了，另外"+(contentList.length-data)+"条成功了！");
				}
				$("#que_ren_tui_song").attr("onclick","queRenTuiSong()");
			});
		}
	}
	//弹出浮层显示图片
	function pictureTipShow(self,pic) {
		var addHeight = 62;
		var thisTop = $(self).offset().top;
		var thisLeft = $(self).offset().left;
		var yuanTu = $(self).parent().find("#yuanTu");
		$("#picture_tip").css("top", thisTop + addHeight);
		$("#picture_tip").css("left", thisLeft);
		$("#picture_tip").html("<font color='red'>"+yuanTu.width()+"*"+yuanTu.height()+"</font><br><img src='"+yuanTu.attr("src")+"' />");
		$("#picture_tip").show();
	}
	function pictureTipHide() {
		$("#picture_tip").hide();
	}
//-->
</script>
<div>
	<div id="audit_menu">
		<a href="javascript:void(0);" onclick="auditManage('2')" id="audit_menu_2">广播审核</a>&nbsp;|&nbsp;
	</div>
	<div id="audit_content"></div>
</div>
<div style="position:absolute;" id="picture_tip" 
			onmouseover="javascript:$(this).show();"
			onmouseout="javascript:$(this).hide();"></div>
